<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%String path = request.getContextPath() ;%>
<s:if test="rb.lastPage>1">
	<table align="center" class="customTablePagination">
		<tr>
			<td width="30%" nowrap>共<s:property value="rb.allCount"/>条记录 第<s:property value="rb.nowPage"/>/<s:property value="rb.lastPage"/>页</td>
			<td width="40%" nowrap>
			<A HREF='javascript:goPage(<s:property value="rb.firstPage"/>)'>首页</A>
			<A HREF='javascript:goPage(<s:property value="rb.previousPage"/>)'>上一页</A> 
			<A HREF='javascript:goPage(<s:property value="rb.nextPage"/>)'>下一页</A> 
			<A HREF='javascript:goPage(<s:property value="rb.lastPage"/>)'>末页</A>
			</td>
			<td width="30%" nowrap>
			转到<SELECT onchange='javascript:goPage(this.options[this.selectedIndex].value)'>
				<SCRIPT LANGUAGE="JavaScript">
				var allPage = <s:property value="rb.lastPage"/>;
				var nowPage = <s:property value="rb.nowPage"/>;
				for(i=1;i<=allPage;i++){
					if(i == nowPage)
						document.write("<option value='"+i+"' selected>"+i+"</option>");
					else
						document.write("<option value='"+i+"'>"+i+"</option>");
				}
				</SCRIPT>
			</SELECT>页
			</td>
			<td nowrap>
			每页
			<select onchange='javascript:setMaxNum(this.options[this.selectedIndex].value)' name="maxNum" >
			<SCRIPT LANGUAGE="JavaScript">
				var _PageMaxNumCollection = [5,10,15,20,30,50,70,100];
				var nowMaxNum = '<s:property value="rb.maxNum"/>';
				for(var i=0;i<_PageMaxNumCollection.length;i++ ){
					if(nowMaxNum == _PageMaxNumCollection[i]){
						document.write("<option value='"+_PageMaxNumCollection[i]+"' selected>"+_PageMaxNumCollection[i]+"</option>");
					}else{
						document.write("<option value='"+_PageMaxNumCollection[i]+"'>"+_PageMaxNumCollection[i]+"</option>");
					}
				}

			</SCRIPT>
			</select>条
			</td>
		</tr>
  </table>
</s:if>
<SCRIPT LANGUAGE="JavaScript">
/**wait.show();是在qdevelop.tool.js中定义的，所有页面均可引用**/
/**当前页URL**/
var focusUrl = '<s:property value="#session._FOCUS_URL_SESSION_KEY"/>';
/*
*	去往第几页
*/
 var goPage = function(num){
	 wait.show();
	 var tmp = focusUrl.replace(/[?|\&amp;]page=([0-9]*)/g,'');
	location.href = tmp+'&page='+num;
 }

/*
*	设置最大显示数
*/
var setMaxNum = function(num){
	wait.show();
	 var tmp = focusUrl.replace(/[?|\&amp;]maxNum=([0-9]*)/g,'');
	 tmp = tmp.replace(/[?|\&amp;]page=([0-9]*)/g,'');
	location.href = tmp+'&page=1&maxNum='+num;
}

/*
*	排序
*/
var goOrder = function(_orderName){
	wait.show();
	var _isDesc = false;
	if(focusUrl.indexOf('order='+_orderName)>-1&&focusUrl.indexOf('order='+_orderName+'%20desc')>-1){
			_isDesc = true;
	}
	var tmp = focusUrl.replace(/[?|\&amp;]order=([a-z|A-Z|\_|\.|\s|0-9|\%20desc]*)/g,'');
	if(_isDesc){
		location.href = tmp.indexOf('?')>-1?(tmp+'&order='+_orderName):(tmp+'?order='+_orderName);
	}else{
		location.href =tmp.indexOf('?')>-1?(tmp+'&order='+_orderName+' desc'):(tmp+'?order='+_orderName+' desc');
	}
}

/**Table加载时，直接生成是否是倒序显示的图标**/
if(focusUrl.indexOf('order')>-1){
	var _pageOrder = focusUrl.substring(focusUrl.indexOf('order')+6);
	if(_pageOrder.indexOf('&')>-1)_pageOrder = _pageOrder.substring(0,_pageOrder.indexOf('&'));
	var _isDesc = false;
	if(_pageOrder.indexOf('desc')>-1){
		_isDesc = true;
		_pageOrder = _pageOrder.replace('%20desc','');
	}
	var obj = $('a[href*="javascript:goOrder(\''+_pageOrder+'\')"]');
	obj.html(obj.html()+(_isDesc?"↓":"↑"));
}

</SCRIPT>